home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1994
/
MacHack 1994.toast
/
MacHack™94
/
Talks & Papers
/
Timothy Knox
/
yerk 3.66
/
Toolbox Classes
/
date
< prev
next >
Wrap
Text File
|
1994-06-24
|
1KB
|
53 lines
\ Date - Date/time support
\ 01/15/85 cbd Version 1
\ 03/11/87 rfl ability to put any date in and print it
\ also changed basicstr to bytes
\ 01/19/90 rfl added getTime:
\ 04/10/93 rfl added getDate:
Decimal
\ ( secs dtRec -- )
Create secs2date popA0 popD0 $ a9c6 w, next,
: dig2 0 <# # # #> type ;
:CLASS DateTime <Super Object
Int Year
Int Month
Int Day
Int Hour
Int Minute
Int Second
Int dayOfWeek
22 bytes dayNames
\ get the system date and time
:M GET: $ 20c -base @ (abs) secs2date ;M
:M PUT: (abs) secs2date ;M
:M PRINTDAY: get: dayOfWeek 1- 3 * addr: dayNames +
3 type ;M
:M PRINTDATE: get: month dig2 ascii / emit
get: day dig2 ascii / emit
get: year 1900 - dig2 ;M
:M PRINTTIME: get: hour dig2 ascii : emit
get: minute dig2 ascii : emit get: second dig2 ;M
:M classINIT: " SunMonTueWedThuFriSat" addr: dayNames swap cmove ;M
:M PRINT: printday: self space printdate: self
2 spaces printtime: self ;M
:M getTime: get: hour get: minute get: second ;M
:M getDate: get: year get: month get: day ;M
;CLASS
dateTime sysDate